package ai.plantdata.Behavior.mode.NullObjectPattern.factory;

import ai.plantdata.Behavior.mode.NullObjectPattern.abstractClasses.AbstractCustomer;
import ai.plantdata.Behavior.mode.NullObjectPattern.abstractClasses.impl.NullCustomer;
import ai.plantdata.Behavior.mode.NullObjectPattern.abstractClasses.impl.RealCustomer;

/**
 * @Author: WangHui
 * @Date: 2020/12/23 16:44
 * @Description:
 */
public class CustomerFactory {
    public static final String[] NAMES = {"Rob","Joe","Julie"};

    public static AbstractCustomer getCustomer(String name){
        for (String s : NAMES) {
            if (s.equalsIgnoreCase(name)) {
                return new RealCustomer(name);
            }
        }
        return new NullCustomer();
    }
}
